package com.designpattern.singleton;

/**
 * 懒汉式单例， doubleCheck
 * @author David
 *
 */
public class Singleton2 {
	private volatile static Singleton2 singleton;
	
	private Singleton2(){
		
	}
	
	public static Singleton2 getInstance(){
		if(singleton==null){
			synchronized(Singleton2.class){
				if(singleton==null){
					singleton = new Singleton2();
				}
			}
		}
		return singleton;
	}
	
	
	public void print(){
		System.out.println("this is doubleCheck Singleton2");
	}
}
